﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace LoA.PhysicsEngine {
	public partial class PhysicsComponent {
		public override void Draw(GameTime gameTime) {
			foreach (var p in this.objects) {
				p.Draw(Camera);
			}


		/*	var state = Mouse.GetState( );

			var position = new Vector2(state.X, state.Y);

			Vector3 nearSource = new Vector3(position, 0f);
			Vector3 farSource = new Vector3(position, 1f);

			// use Viewport.Unproject to tell what those two screen space positions
			// would be in world space. we'll need the projection matrix and view
			// matrix, which we have saved as member variables. We also need a world
			// matrix, which can just be identity.
			Vector3 nearPoint = this.GraphicsDevice.Viewport.Unproject(nearSource,
				this.Camera.ProjectionMatrix, this.Camera.ViewMatrix, Matrix.Identity);

			Vector3 farPoint = this.GraphicsDevice.Viewport.Unproject(farSource,
				this.Camera.ProjectionMatrix, this.Camera.ViewMatrix, Matrix.Identity);

			// find the direction vector that goes from the nearPoint to the farPoint
			// and normalize it....
			Vector3 direction = farPoint - nearPoint;
			direction.Normalize( );

			var LastRay = new Ray(nearPoint, direction);

			pointModel.CorrectPosition(this, LastRay.Position);
			pointModel.CorrectDirection(this, LastRay.Direction);

			pointModel.Draw(this.Camera);*/

			base.Draw(gameTime);
		}
	}
}
